/**
 * 1
 *  
 * @Author : roryrywang
 * @DateTime : 24-8-25 下午6:51
 */

#include <iostream>
#include <vector>

using namespace std;

double cycles(const string &s1, const string &s2) {
    int hour = 0, min = 0, second = 0;

    int s1hour = stoi(s1.substr(0, 2));
    int s1min = stoi(s1.substr(3, 2));
    int s1second = stoi(s1.substr(6, 2));
    int s2hour = stoi(s2.substr(0, 2));
    int s2min = stoi(s2.substr(3, 2));
    int s2second = stoi(s2.substr(6, 2));

    second = s2second - s1second;
    if (second < 0) {
        second += 60;
        min--;
    }
    min += (s2min - s1min);
    if (min < 0) {
        min += 60;
        hour--;
    }
    hour += (s2hour - s1hour);
    if (hour < 0) {
        hour += 24;
    }

    return hour * 60.0 + min * 1.0 + (second / 60.0);
}

int main() {
    int n;
    cin >> n;
    vector<string> strs(n);
    for (int i = 0; i < n; ++i) {
        cin >> strs[i];
    }
    printf("%.10f", cycles(strs[0], strs[1]));
    for (int i = 2; i < n; ++i) {
        printf(" %.10f", cycles(strs[i - 1], strs[i]));
    }
    return 0;
}
// 64 位输出请用 printf("%lld")